package com.liry.security.domain.vo;

import com.liry.security.config.CustomUser;
import com.liry.security.domain.entity.SysUser;
import java.util.HashSet;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.authority.AuthorityUtils;

/**
 * @author ALI
 * @since 2023/6/4
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UserView extends CustomUser {

    private static final long serialVersionUID = 2516196109693691826L;

    private String token;

    public UserView(CustomUser sysUser) {
        this.userId = sysUser.getUserId();
        this.username = sysUser.getUsername();
        this.authorities = sysUser.getAuthorities();
    }

    public UserView(CustomUser sysUser, String token) {
        this.userId = sysUser.getUserId();
        this.username = sysUser.getUsername();
        this.authorities = sysUser.getAuthorities();
        this.token = token;
    }
}
